<%@ page import="driver.service.PayforServiceImple_u" %>
<%@ page import="driver.entity.Payfor" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.text.SimpleDateFormat" %><%--
  Created by IntelliJ IDEA.
  User: LSK
  Date: 2019/10/17
  Time: 17:00
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<html>

<head>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>西安学车管家</title>
    <link rel="shortcut icon" href="img/bitbug_favicon.ico">
    <base target="_blank" />
    <link rel="stylesheet" href="bootstrap/dist/css/bootstrap.min.css">
    <title>用户:查看自己的所有赔付申请、赔付状态</title>
</head>
<style>
    body {
        margin: 0;
        padding: 0;
        background-color: rgb(241, 241, 241);
    }

    #search {
        background: #ffffff;
        box-shadow: 2px 0px 15px 1px rgb(231, 231, 231);
    }

    #search li {
        border-bottom: 1px solid rgb(255, 255, 255);
    }

    #search li:hover {
        border-bottom: 1px solid #5FB878;
    }

    #search .navbar-brand:hover,
    #search li a:hover {
        color: #5FB878;
    }

    .container {
        background: #fff;
    }

    .table2 td,
    th,
    tr {
        font-size: 13px;
    }
</style>

<body>
    <!--导航条-->
    <nav class="navbar navbar-default " id="search">
        <div class="container">
            <!-- Brand and toggle get grouped for better mobile display -->
            <div class="navbar-header">
                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
                    data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a target="_blank"  class="navbar-brand" href="index.jsp" data-toggle="tooltip" data-placement="bottom" title="返 回 首 页">
                    <img src="asset/logoBig.png" style="width: 100px;height:38px;margin-top: -7px" alt="">
                </a>
            </div>

            <!-- Collect the nav links, forms, and other content for toggling -->
            <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                <ul class="nav navbar-nav">

                </ul>

            </div><!-- /.navbar-collapse -->
        </div><!-- /.container-fluid -->
    </nav>
    <!-- 内容主体 -->
    <div class="container">
        <div>
            <h2 class=" h2">处理理赔</h2>
            <table style="text-align:center" id="table2" class="table table-bordered">
                <tr>
                    <th>学员姓名</th>
                    <th>学员手机号码</th>
                    <th>申请理赔时间</th>
                    <th>考试时间</th>
                    <th>考试地点</th>

                    <th>理赔科目</th>
                    <th>理赔金额</th>

                    <th>审核状态</th>
                    <th>审核意见</th>
                    <th>查看详情</th>
                </tr>
                <%
               // String phonenum=request.getParameter("num");


                //String id = String.valueOf(session.getAttribute("id"));
                /*String phonenum1=String.valueOf(session.getAttribute("num"));
                String phonenum;
                //System.out.println(request.getParameter("id"));
                //String payfor_id;
                if(phonenum1.equals("null"))
                {
                    phonenum=request.getParameter("id");
                }
                else
                {
                    phonenum=phonenum1;
                }*/
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss");
                String phonenum=request.getParameter("num");


                PayforServiceImple_u service=new PayforServiceImple_u();
                ArrayList<Payfor> payfors = service.select_all(phonenum,phonenum);
                //System.out.println(payfors.size());
                for(Payfor payfor:payfors)
                {
                    //System.out.println(payfor.toString());
                    out.print("<tr>");
                    out.print("<td>"+payfor.getName()+"</td>");
                    out.print("<td>"+payfor.getPhonenum()+"</td>");
                    out.print("<td>"+sdf.format(payfor.getTime())+"</td>");
                    out.print("<td>"+payfor.getExamtime()+"</td>");
                    out.print("<td>"+payfor.getExamadd()+"</td>");


                    //增加理赔科目和理赔金额
                    out.print("<td>"+payfor.getPayitem()+"</td>");
                    //out.print("<td>"+payfor.getName()+"</td>");
                    if(payfor.getPayitem().equals("科目一"))
                        out.print("<td>60</td>");
                    else if(payfor.getPayitem().equals("科目二"))
                        out.print("<td>240</td>");
                    else if(payfor.getPayitem().equals("科目三"))
                        out.print("<td>128</td>");
                    else
                        out.print("<td>0</td>");

                    //out.print("<td>"+payfor.isFlag()+"</td>");
                    //0审核未通过或审核中 1审核通过
                   /* if(payfor.isFlag())
                    {
                        out.print("<td>审核通过</td>");
                    }
                    else
                    {
                        out.print("<td>审核未通过或审核中</td>");
                    }*/

                   //三个状态
                    if(payfor.getFlag()==0)
                        out.print("<td>审核中，请耐心等待</td>");
                    else if(payfor.getFlag()==1)
                        out.print("<td>审核通过</td>");
                    else if(payfor.getFlag()==2)
                        out.print("<td>审核未通过，请查看未通过理由</td>");
                    else
                        out.print("<td>状态参数异常，请联系管理员</td>");

                    out.print("<td>"+payfor.getValue()+"</td>");
                    out.print("<td><a target='_blank' style=\"color: #009688\"  href=\""+"applyuserdetails.jsp?id="+payfor.getId()+"\">查看理赔详情</a>"+"</td>");
                    //out.print("<td>"+payfor.getId()+"</td>");

                    out.print("</tr>");
                }
            %>
            </table>
        </div>
    </div>

    <script src="bootstrap/dist/js/jquery-3.4.1.min.js"></script>
    <script src="bootstrap/dist/js/bootstrap.min.js"></script>
    <script src="bootstrap/dist/js/layui/layui.all.js"></script>
    <script>
        /* 鼠标特效 */
        var a_idx = 0;
        jQuery(document).ready(function ($) {
            $("body").click(function (e) {
                var a = ["富强", "民主", "文明", "和谐", "自由", "平等", "公正", "法治", "爱国", "敬业", "诚信", "友善"];
                var $i = $("<span/>").text(a[a_idx]);
                a_idx = (a_idx + 1) % a.length;
                var x = e.pageX,
                    y = e.pageY;
                $i.css({
                    "z-index": 9999999999999999999999999999999999999999,
                    "top": y - 20,
                    "left": x,
                    "position": "absolute",
                    "font-weight": "bold",
                    "color": "#ff6651"
                });
                $("body").append($i);
                $i.animate({
                        "top": y - 180,
                        "opacity": 0
                    },
                    1500,
                    function () {
                        $i.remove();
                    });
            });
        });
        //alert("用户名不存在，请联系管理员");
    </script>
    <script>
        $(function () {
            $('[data-toggle="tooltip"]').tooltip()
        })
    </script>
</body>

</html>